

<template>

  <el-button type="success" :plain="true" @click="f(1)" >Success</el-button>
  <el-button type="warning" :plain="true" @click="f(2)">Warning</el-button>
  <el-button :plain="true" @click="f(4)">Message</el-button>
  <el-button :plain="true" @click="f(3)">Error</el-button>
  <el-button :plain="true" @click="f(5)">Error</el-button>





</template>

<script  setup>
import { ElMessage } from 'element-plus'

const f=(type)=>{
  switch (type){
    case 1:ElMessage.success('成功');break;
    case 2:ElMessage.warning('我要报警了');break;
    case 3:ElMessage.error('我要报错了');break;
    case 4:ElMessage('一般');break;
    case 5:ElMessage.error({message:'可关闭的消息',showClose:true});break;
  }
}
</script>

<style scoped>

</style>